/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-09-15
 * Time: 15:19
 */
class Animal{

    // 父类的构造方法
    public Animal() {
    }

    // 父类的方法
    public void eat() {
        System.out.println("父类在吃东西");
    }

    public void sleep() {
        System.out.println("父类在睡觉");
    }

    public static void main(String[] args) {
        Animal animal1 = new Animal();
        Animal animal2 = new Dog();
        animal1.eat();
        animal2.eat();
        Dog dog = new Dog();
        dog.eat();
    }
}


class Dog extends Animal{

    public Dog() {

    }

    public void eat() {
        System.out.println("子类在吃东西");
    }


}
